package ca.ubc.cpsc210.waldo.model;

import java.util.HashSet;
import java.util.Set;

import ca.ubc.cpsc210.waldo.exceptions.IllegalBusStopException;

public class BusRoute {
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((number == null) ? 0 : number.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		BusRoute other = (BusRoute) obj;
		if (number == null) {
			if (other.number != null)
				return false;
		} else if (!number.equals(other.number))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return number;
	}

	private String number;
	private Set<BusStop> stops;
	private Set<Bus> buses;
	
	public BusRoute(String number) {
		
		this.number = number;
		this.stops = new HashSet<BusStop>();
		this.buses = new HashSet<Bus>();
		
	}
	
	public void addBus(Bus nextBus) {
		buses.add(nextBus);
	}
	
	public void clearBuses() {
		buses = new HashSet<Bus>();
	}
	
	public Set<Bus> getBuses() {
		return buses;
	}
	
	public String getRouteNumber() {
		return number;
	}
}
